home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
CIncludes
/
DeviceNotify.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-01
|
9KB
|
262 lines
/*
File: DeviceNotify.h
Contains: xxx put contents here xxx
Version: Technology: xxx put the technology version here xxx
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
*/
#ifndef __DEVICENOTIFY__
#define __DEVICENOTIFY__
#ifndef __TYPES__
#include <Types.h>
#endif
#ifndef __KERNEL__
#include <Kernel.h>
#endif
#ifndef __NAMEREGISTRY__
#include <NameRegistry.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
#if FOR_SYSTEM8_PREEMPTIVE
/*
ß
##############################################################################
File Name: DeviceNotifyPriv.h
Description:
The device notification service is used by Copland Kernel band
Low level family expert code to inform high level "consumers" about
hot plugging/un-plugging of devices.
The High level families or code modules running in priviledged mode
can subscribe to the service with the DevNRegisterInterestIn().
LL Family notifies its consumers through the DevNNotifyThatThisChanged().
##############################################################################
############################
Defines
############################
*/
typedef UInt32 DevNRef;
/*
a connection Reference Num for a particular subscription
a consumer subscription is identified by a unique
DevNSubRef. In order to cancel a consumer registration,
the DevNSubRef must be specified.
a Reference Num for a particular notification
A notification is identified by a unique DevNRef,
since a notification can go through couple of states, and
it needs to be tracked with a unique identifier.
*/
/*
ß
########################################################################
Known & valid Service Category definitions are defined in DFM.h
########################################################################
*/
enum {
kDevNAllServiceCategories = 0xFFFFFFFF /* an option to subscribe to ALL valid service catagories*/
};
enum {
kMaxNumServiceCategories = 20 /* ***†should be in DFM.h ****/
};
/*
ß
########################################################################
Event definition:
If kDevNSoftRequestMask is set in conjunction with an event value,
then a soft request is indicated, and the DevN will handle all the
drudgery associated with two-way transactions, etc.
(e.g. If (kDevNRemoved and kDevNSoftRequestMask) is received, it's
a soft eject request)
If kDevNSoftRequestMask is NOT set, then it's a hard request
If the kDevNWarningMask is set, then it's an event warning that
a given event is about to happen (and the consumer can't do a thing
about it). It will be followed later on by a gone hard event.
the kDevNWarningMask and the kDevNSoftRequestMask can NOT be set at
the same time.
########################################################################
*/
typedef UInt32 DevNEventType;
/*
pre-defined event mask
ß
definition of valid global event
(10/11/95) Events are now enum instead of masks
enum for "unsigned" values
*/
enum {
kDevNSoftRequestMask = 0x80000000, /* bit indicating soft request*/
kDevNWarningMask = 0x40000000, /* bit indicating a warning request*/
kDevNAdded = 0, /* New device/media/bus available*/
kDevNRemoved = 1, /* Existing device/media/bus now gone*/
kDevNWakeup = 2, /* Plug-in sw state no longer needs synchronization*/
kDevNSleep = 3, /* Ask to synchronize SOFTWARE state of plug-in*/
/* ...used by PowerMgr, DriverReplacer, Soft Dev Eject*/
kDevNBootComplete = 4, /* used by motherboard expert to inform DFM boot complete*/
kDevNIOInitComplete = 5, /* I/O system initialize complete*/
kDevNNumOfPredefinedEvtInUse = 6,
kDevNHighestEvtInUse = 5
};
/* enum for "signed" values*/
enum {
kDevNSoftEject = 0x80000001 /* (kDevNRemoved | kDevNSoftRequestMask)*/
};
/*
ß
########################################################################
Routine return value definition
########################################################################
*/
typedef UInt32 DevNPermissionResponse;
/* status returned by consumer to DevN*/
enum {
kDevNPermissionGranted = 0, /* consumer consented that instant removal of*/
/* node is OK */
kDevNPermissionDelayed = 1, /* can not grant permission now, will inform producer through .*/
/* DevN at a later time (ignored by the DevN if hard request) */
kDevNPermissionDenied = 2, /* do Not allow requested event to take place*/
/* (ignored by the DevN if hard request)*/
kDevNValidPermissionMasks = 3
};
/*
########################################################################
Error code definition
########################################################################
*/
enum {
kDevNMErrorCodeBase = 0,
kInvalidSC = kDevNMErrorCodeBase + 1, /* subscribe with invalid Service Category code*/
kInvalidEvent = kDevNMErrorCodeBase + 2, /* subscribe with invalid event mask (zero)*/
kInvalidHandler = kDevNMErrorCodeBase + 3, /* subscribe with NULL handler address*/
kNoSuchRef = kDevNMErrorCodeBase + 4, /* Specified ID can not be found*/
kRecordNotFound = kDevNMErrorCodeBase + 5, /* while unregistering, can not find record in array*/
kNotEnoughEventMask = kDevNMErrorCodeBase + 6, /* not enough masks for DevNMCreateNewEvent call*/
kDeleteInvalidMasks = kDevNMErrorCodeBase + 7, /* attempt to DevNMDeleteNewEvent on invalid event masks*/
kInvalidEventCount = kDevNMErrorCodeBase + 8, /* invalid event count parameter being passed in*/
kInvalidPermission = kDevNMErrorCodeBase + 9, /* bad permission returned from consumer*/
kTokenNotFound = kDevNMErrorCodeBase + 10 /* sub record lookup list token not found*/
};
/*
########################################################################
Subroutine Prototype
########################################################################
no more handlers
######################
called by consumer
######################
*/
extern OSStatus DevNRegisterInterestIn(OSType myFamily, ItemCount eventCount, DevNEventType *events, ObjectID adminMessageObj, DevNRef *thisRegistration, void *parm);
extern OSStatus DevNUnregisterInterest(DevNRef thisID);
extern OSStatus DevNMCreateNewEvent(DevNEventType *result);
/*
call to register family defined events.
itemCount specifies how many events are desired
(Only create one event at a time)
*/
extern OSStatus DevNMDeleteNewEvent(DevNEventType event);
/* de-register the given event*/
extern OSStatus DevNDelayedDownwardNotify(DevNRef notifyRef, DevNRef subscriptionRef, DevNPermissionResponse permission);
/*
must be called after an kDevNPermissionDelayed is returned to the DevN
for a notification response.
######################
called by producer
######################
*/
extern DevNPermissionResponse DevNNotifyThatThisChanged(OSType whichServiceCategory, DevNEventType whatHappened, RegEntryRef *whichDevice, ObjectID adminMessageObj, DevNRef *notRef, void *parm);
extern DevNPermissionResponse DevNNotifyEvents(DevNEventType whatHappened, RegEntryRef *whichDevice, ObjectID adminMessageObj, DevNRef *notRef, void *parm);
/*
#####################################
Notification Message definitions
#####################################
*/
struct DevNMessage {
UInt32 AdminMessageType;
UInt32 subMessageType;
OSType serviceCategory;
DevNEventType event;
RegEntryRef * device;
void * parm;
DevNRef notRef;
DevNPermissionResponse returnPermission;
};
typedef struct DevNMessage DevNMessage;
/*
#########################################################
Device Notification sub-message types.
(This is in the "subMessageType" field inside
The DevNMessage structure)
#########################################################
*/
enum {
kDevNNotifyMsg = 0x01,
kDevNNotifyCancel = 0x02,
kDevNNotifyDelayedReply = 0x03,
kNextUnusedMsg = 0x04
};
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import off
#endif
#ifdef __cplusplus
}
#endif
#endif /* __DEVICENOTIFY__ */